﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using TCHSHue.BLL;
namespace TCHSHue.Modules
{
    /// <summary>
    /// Summary description for CaptchaHandler
    /// </summary>
    public class CaptchaHandler : IHttpHandler, System.Web.SessionState.IReadOnlySessionState
    {

        public void ProcessRequest(HttpContext context)
        {
            context.Response.ContentType = "image/jpeg";

            string text = string.Empty;
            if (context.Session["captcha"] != null)
                text = (string)context.Session["captcha"];
            CaptchaBLL captCha = new CaptchaBLL();
            captCha.CreateCatchaImage(text).Save(context.Response.OutputStream, System.Drawing.Imaging.ImageFormat.Jpeg);
        }
        public bool IsReusable
        {
            get
            {
                return false;
            }
        }
    }
}